package com.revzone.demo001.entity.PermissionEntity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.revzone.demo001.entity.OtherEntity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *
 * </p>
 *
 * @author lsa
 * @since 2023-04-04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "role",autoResultMap = true)
public class Role extends BaseEntity<Role> implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty("角色主键ID")
    private Integer id;

    @TableField("role_name")
    @ApiModelProperty("角色名称")
    private String roleName;

    @TableField("nick_name")
    @ApiModelProperty("别名")
    private String nickName;

    @TableField(value = "menu_list",typeHandler = FastjsonTypeHandler.class, jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty("菜单列表")
    private Map menuList;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("创建是时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("create_date")
    private Date createDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("修改时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("update_date")
    private Date updateDate;

    @TableField("status")
    @ApiModelProperty("状态")
    private Integer status;

    @TableField("remarks")
    @ApiModelProperty("备注")
    private String remarks;

    @TableField(exist = false)//非数据库字段
    @ApiModelProperty("用户列表")
    private List<User> Users;

}
